<? if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
foreach ($arResult["ITEMS"]["AnDelCanBuy"] as $key => $arElement)
{
 $element=GetIBlockElement($arElement["PRODUCT_ID"]); 
 $element["DISPLAY_PROPERTIES"] = array();
 $prop=$element["PROPERTIES"]["PHOTOS"];
 $rela=$element["PROPERTIES"]["RELATED"];
 $element["DISPLAY_PROPERTIES"]["PHOTOS"] = CIBlockFormatProperties::GetDisplayValue($arResult, $prop, "catalog_out");
 $element["DISPLAY_PROPERIES"]["RELATED"] = CIBlockFormatProperties::GetDisplayValue($arResult, $rela, "catalog_out");
// resize picture
 //echo $element["DISPLAY_PROPERTIES"]["PHOTOS"]["FILE_VALUE"]["0"]["SRC"];

 $arResult["ITEMS"]["AnDelCanBuy"][$key]["PHOTO_PREVIEW"]=$APPLICATION->IncludeComponent("soulstream:imager", "", Array(
									        "MODE" => "4",
											"RETURN" => "src",
											"IMAGE" =>GetFirstFilePathFromProp($element["DISPLAY_PROPERTIES"]["PHOTOS"]),
											"WIDTH" => "68",
											"HEIGHT" => "68",
											"ADD_WATERMARK" => "N",
											"ADD_TEXT" =>"N", 
											"ADD_CORNER" => "N",
											),false, array("HIDE_ICONS"=>"Y")
										);
 //echo $element["PHOTO_PREVIEW"];
 //arrPrintEx($element);
 foreach($arResult["PROPERTIES"]["RELATED"]["VALUE"] as $arItemRelay)
            {            	
							$item_info = CIBlockElement::GetList(array(),array("ID"=>$arItemRelay),false,false,array("IBLOCK_ID","ID"))->GetNext();
                            $props = GetAllPropertyByIBlockID($item_info["IBLOCK_ID"],true);
							
$arResult["ITEMS"]["AnDelCanBuy"][$key]["RELATED_ITEM"]=$APPLICATION->IncludeComponent(
												"bitrix:catalog.element",
												"similar",
												Array(
													"IBLOCK_TYPE" => "catalog",
													"IBLOCK_ID" => $item_info["IBLOCK_ID"],
													"ELEMENT_ID" => $item_info["ID"],
													"ELEMENT_CODE" => "",
													"SECTION_ID" => "",
													"SECTION_CODE" => "",
													"SECTION_URL" => "",
													"DETAIL_URL" => $item_info["IBLOCK_CODE"]=="3"?"/catalog/#IBLOCK_CODE#/#SECTION_CODE#/#ELEMENT_CODE#.php":"/catalog/#IBLOCK_CODE#/#ELEMENT_CODE#.php",
													"BASKET_URL" => "/personal/basket.php",
													"ACTION_VARIABLE" => "action",
													"PRODUCT_ID_VARIABLE" => "id",
													"PRODUCT_QUANTITY_VARIABLE" => "quantity",
													"PRODUCT_PROPS_VARIABLE" => "prop",
													"SECTION_ID_VARIABLE" => "SECTION_ID",
													"META_KEYWORDS" => "-",
													"META_DESCRIPTION" => "-",
													"BROWSER_TITLE" => "-",
													"SET_TITLE" => "N",
													"SET_STATUS_404" => "N",
													"ADD_SECTIONS_CHAIN" => "N",
													"PROPERTY_CODE" => GetAllPropertyByIBlockID($item_info["IBLOCK_ID"],true),
													"PRICE_CODE" => array("SALE","BASE"),
													"USE_PRICE_COUNT" => "N",
													"SHOW_PRICE_COUNT" => "1",
													"PRICE_VAT_INCLUDE" => "Y",
													"PRICE_VAT_SHOW_VALUE" => "N",
													"USE_PRODUCT_QUANTITY" => "N",
													"LINK_IBLOCK_TYPE" => "",
													"LINK_IBLOCK_ID" => "",
													"LINK_PROPERTY_SID" => "",
													"LINK_ELEMENTS_URL" => "link.php?PARENT_ELEMENT_ID=#ELEMENT_ID#",
													"CACHE_TYPE" => "A",
													"CACHE_TIME" => "36000000",
													"CACHE_GROUPS" => "Y",
)
											);



};
};


?>